function sendReq(url,para,succ,fail){
	$.ajax({
		type : "post",
		url : url,
		dataType : "json",
		data : para,
		error : function(msg) {
			if(typeof fail == "function"){
				fail(msg);
			}
		},
		success : function(data) {
			if(typeof succ == "function")
			succ(data);
		}
	});
}
function sendReq1(url,para,succ,fail){
	$.ajax({
		type : "post",
		url : url,
		dataType : "json",
		data : para,
		async : false,
		error : function(msg) {
			if(typeof fail == "function"){
				fail(msg);
			}
		},
		success : function(data) {
			if(typeof succ == "function")
			succ(data);
		}
	});
}


/**
 * 发送跨域请求
 * @param url
 * @param para
 */
function sendAcrossReq(url,para){
	$.ajax({
		type : "post",
		url : url,
		dataType : "jsonp",
		data : para
	});
}

function onError(){
	
	
}
/**
 * 参数是一个回调方法，是获取位置成功后的回调
 * 方法会传入两个参数(经度，纬度)
 * @param callback
 */
function getLocation(callback){
  var options={
      enableHighAccuracy:true, 
      maximumAge:1000
  }
  if(navigator.geolocation){
      //浏览器支持geolocation
      navigator.geolocation.getCurrentPosition(function(position){
      	var longitude =position.coords.longitude;//经度
        var latitude = position.coords.latitude;//纬度
         if(typeof callback == "function"){
        	 callback(longitude,latitude);
         }
      },onError,options);
  }else{
      //浏览器不支持geolocation
  }
}

function showWait(){
	var dialog = window._waitingDlg;
	if(!dialog){
		dialog = new WaittingDialog();
		window._waitingDlg = dialog;
	}
	dialog.show();
}

function hideWait(){
	var dialog = window._waitingDlg;
	if(dialog){
		dialog.hide();
	}
}

function WaittingDialog(){
	this.init();
}

WaittingDialog.prototype.init = function(){
	var html = '<article class="loaders_box" style="display:none">\
		<div class="bg_box"></div>\
		<div class="iframe_box">\
			<article class="loaders_inner">\
				<div class="loaders_scale">\
					<div class="loader-inner line-scale">\
				      <div></div>\
				      <div></div>\
				      <div></div>\
				      <div></div>\
				      <div></div>\
				    </div>\
			    </div>\
		   		<p>加载中</p>\
		  	</article>\
		</div>\
		</article>';
	this.$html = $(html).appendTo(document.body);
}

WaittingDialog.prototype.show = function(){
	this.$html.show();
}

WaittingDialog.prototype.hide = function(){
	this.$html.hide();
}
